package com.xayy.health.core.enums;

import lombok.Getter;

/**
 * 关联类型枚举
 *
 * @author houchengwei
 * createTime 2023/2/20
 * @version V1.0
 */
public enum RelationTypeEnum {
    //串联
    SERIES_CONNECTION(1, "串联"),
    //并联
    PARALLEL_CONNECTION(2, "并联"),
    //冗余
    REDUNDANCE(3, "冗余");

    @Getter
    private Integer code;

    @Getter
    private String name;

    RelationTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }


    public static String valueof(Integer index) {
        for (RelationTypeEnum relationTypeEnum : values()) {
            if (relationTypeEnum.getCode().equals(index)) {
                return relationTypeEnum.name;
            }
        }
        return "";
    }
}
